FROM maven:3.3-jdk-7 as BUILDER
LABEL xiawen <fxiaxiaoyu@gmail.com>

# ENV REFRESHED_AT 2016-01-24
ENV ONLINE_CONFIG_PATH /home/work/dsp/disconf-rd/online-resources
ENV WAR_ROOT_PATH /home/work/dsp/disconf-rd/working/war
ENV DISCONF_VER 2.6.36

COPY ./config/ $ONLINE_CONFIG_PATH/
RUN curl -fSL https://github.com/knightliao/disconf/archive/${DISCONF_VER}.zip -o ${DISCONF_VER}.zip \
    && unzip ${DISCONF_VER}.zip

WORKDIR /disconf-${DISCONF_VER}/disconf-web 
RUN sh deploy/deploy.sh

#################################
FROM tomcat:7.0
LABEL xiawen <fxiaxiaoyu@gmail.com>

# ENV REFRESHED_AT 2016-01-24

COPY --from=BUILDER /home/work/dsp/disconf-rd/working/war/ /usr/local/tomcat/webapps/
COPY server.xml /usr/local/tomcat/conf/server.xml

# CMD ["catalina.sh", "run"]

